import { takeEvery, put } from 'redux-saga/effects'
import axios from 'axios'
import { List } from 'immutable'
import {loadDataSync} from './actionCreator'

function* loadDataDoctorTeam(action) {
    const result = yield axios.get(
        '/api/doctorTeam?hospitalid='+action.id 
    )
    yield put(loadDataSync(List(result.data)))
}

function* doctorTeamSaga() {
    yield takeEvery('loadDataDoctorTeamSaga', loadDataDoctorTeam)
}

export default doctorTeamSaga